import * as React from 'react';
import { Point, Range, OperaType } from '../../reducer/const';
import { PathString } from '../../util/eventUtil';

import { INodeProps } from './TaskNode';
import BranchNode from './BranchNode';


export default class ConditionNode extends BranchNode {

    constructor(props: INodeProps) {
        super(props);
        this.strokeIconWidth = 3;
    }


    getIconAttr() {
        const iconAttr = { 'stroke': `${this.colorIcon}`, 'fill': `none`, 'stroke-width': `${this.strokeIconWidth}`, 'transform': `${300}` };
        return iconAttr;
    }

    getIconPath(range: Range) {
        const r = 5;
        const center: Point = new Point(range.x + range.height / 2, range.y + range.height / 2 - r / 2);
        const pathString: PathString = new PathString();
        pathString.M(center.x - r, center.y);
        for (let ang = -180; ang <= 90; ang += 5) {
            pathString.L(center.x + r * Math.cos(ang * 3.14 / 180), center.y + r * Math.sin(ang * 3.14 / 180));
        }
        pathString.L(center.x, center.y + r + this.strokeIconWidth);
        pathString.M(center.x, center.y + r + this.strokeIconWidth * 2);
        pathString.L(center.x, center.y + r + this.strokeIconWidth * 3);



        return pathString.toString();
    }



}
